package com.cbank.dao;

import com.cbank.domain.AboutUs;
import com.cbank.domain.BaseEntity;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Repository
public interface AboutUsDao {

    public static final String ALL="id,view_id,create_time,update_time,cn_article,en_article";

    @Select("select "+ALL+" from about_us where status = "+ BaseEntity.STATUS_VALID+" limit 1")
    AboutUs getAll();

    @Select("select "+ALL+" from about_us where id = #{id}")
    AboutUs getById(Integer id);

    @Select("select "+ALL+" from about_us where view_id = #{viewId}")
    AboutUs getByViewId(String viewId);

    @Insert("insert into about_us (view_id,cn_article,en_article) values(#{viewId},#{cnArticle},#{enArticle})")
    @Options(useGeneratedKeys = true)
    void insert(AboutUs aboutUs);

    @Update("update about_us set view_id=#{viewId},cn_article=#{cnArticle},en_article=#{enArticle} where id = #{id}")
    void uodateAboutUs(AboutUs aboutUs);


}
